-
Couldn't load subscription status.
- Fork 0
feat: auth and Keycloak integration #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
- create jwt utils - update .env with jwt and keycloak base url
- create authMiddleware - create login route - basic create/find user repository
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements authentication and Keycloak integration by adding JWT-based authentication middleware and a login endpoint that validates users against Keycloak and creates database records for new users.
Key Changes:
- Implemented JWT utilities for signing, verifying, and decoding tokens
- Created authentication flow with Keycloak OAuth2 password grant integration
- Added protected route middleware using JWT token verification
Reviewed Changes
Copilot reviewed 14 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/jwt.ts | JWT utility functions for token signing, verification, and Keycloak token decoding |
| src/usecase/auth/authUsecase.ts | Business logic for user authentication, registration, and Keycloak user mapping |
| src/repository/user/userRepository.ts | Database operations for user creation and existence checking |
| src/controller/auth/authController.ts | HTTP request handler for login endpoint |
| src/middleware/authMiddleware.ts | JWT authentication middleware for protected routes |
| src/middleware/errorHandler.ts | Global error handling middleware |
| src/lib/api.ts | Keycloak API client for token retrieval |
| src/router/authRouter.ts | Router configuration for authentication endpoints |
| src/router/index.ts | Integration of auth router into main routing |
| src/types/error/ApiError.ts | Custom error class for API-related errors |
| src/app.ts | Error handler middleware integration |
| prisma/schema.prisma | User model and role/education level enums |
| package.json | Added jsonwebtoken type definitions |
| .env.example | Environment variable examples for JWT and Keycloak configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
corrected spelling Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 14 out of 18 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes
authMiddlewarefor protected-route using JWT/api/auth/loginfor validate/login user from Keycloak and add to database if not exists